"""
@author: 景云鹏
@email: 310491287@qq.com
@date: 2022/6/15
"""
import numpy
from numpy import random
from numpy import linalg

for i in range(1000000):
    m = random.randint(3, 10)
    n = random.randint(2, m)
    a = random.random(size=(m, n))
    ap = linalg.pinv(a)
    b = random.random(size=(m, 1)) * 10

    if i % 10000 == 1:
        print(i, '=====')
    a = numpy.mat(a)
    b = numpy.mat(b)
    ap = numpy.mat(ap)
    d = b - a*ap*b
    p = a.T*d
    if not any(p):
        print(a, b, numpy.mat(a) * numpy.mat(ap) * numpy.mat(b))
        break
